package com.atguigu.a_oop;
/*
    测试类
 */
public class Demo {
    //入口
    public static void main(String[] args) {
        //创建对象
        Student stu1 = new Student();
        //获取对象的属性
        System.out.println("stu1.name = " + stu1.name);
        System.out.println("stu1.age = " + stu1.age);
        System.out.println("stu1.className = " + stu1.className);
        //赋值
        stu1.name = "张三";
        stu1.age = 18;
        stu1.className = "三年二班";
        //获取对象的属性
        System.out.println("stu1.name = " + stu1.name);
        System.out.println("stu1.age = " + stu1.age);
        System.out.println("stu1.className = " + stu1.className);

        //调用对象的行为
        stu1.eat("汉堡包");
        stu1.study();

        System.out.println("----------------------");

        //再次创建学生对象
        Student stu2 = new Student();//只要new 就创建了新的对象,开辟了新的内存空间
        //获取对象的属性
        System.out.println("stu2.name = " + stu2.name);
        System.out.println("stu2.age = " + stu2.age);
        System.out.println("stu2.className = " + stu2.className);

    }
}
